import React from 'react';
import CommonPage from '@/components/page/CommonPage';
import { renderNumber } from '@/utils/common';
import { format } from '@/utils/datetime';

const daoName = 'CompJwz';
const importName = 'CompJwz';
const columns: API.Column[] = [
  {
    title: '导入结果',
    width: 250,
    sorter: true,
    key: 'DRJG',
    dataIndex: 'DRJG',
    dispaly: true,
    filter: false,
    export: false,
  },
  {
    title: '导入日期',
    width: 130,
    sorter: true,
    key: 'NY',
    dataIndex: 'NY',
    dispaly: true,
    filter: true,
    export: false,
  },
  {
    title: '实际融资人',
    width: 250,
    sorter: true,
    dataIndex: 'SJRZR',
    key: 'SJRZR',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '业务类型',
    width: 180,
    sorter: true,
    key: 'YWLX',
    dataIndex: 'YWLX',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '起息日',
    width: 100,
    sorter: true,
    key: 'QXR',
    dataIndex: 'QXR',
    render: (data) => format(data, 'yyyy-MM-dd'),
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '到期日',
    width: 100,
    sorter: true,
    key: 'DQR',
    dataIndex: 'DQR',
    render: (data) => format(data, 'yyyy-MM-dd'),
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '币种',
    width: 110,
    sorter: true,
    key: 'BZ',
    dataIndex: 'BZ',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '余额(万)',
    width: 120,
    sorter: true,
    key: 'ACBL',
    dataIndex: 'ACBL',
    dispaly: true,
    filter: true,
    export: true,
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '利润(万)',
    width: 120,
    sorter: true,
    key: 'LR',
    dataIndex: 'LR',
    dispaly: true,
    filter: true,
    export: true,
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '员工1',
    width: 140,
    sorter: true,
    key: 'EMNO1',
    dataIndex: 'EMNO1',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比1(%)',
    width: 120,
    sorter: true,
    key: 'ZB1',
    dataIndex: 'ZB1',
    dispaly: true,
    //filter: true,
    export: true,
  },
  {
    title: '员工2',
    width: 100,
    sorter: true,
    key: 'EMNO2',
    dataIndex: 'EMNO2',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比2(%)',
    width: 100,
    sorter: true,
    key: 'ZB2',
    dataIndex: 'ZB2',
    dispaly: true,
    //filter: true,
    export: true,
  },
  {
    title: '员工3',
    width: 100,
    sorter: true,
    key: 'EMNO3',
    dataIndex: 'EMNO3',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比3(%)',
    width: 100,
    sorter: true,
    key: 'ZB3',
    dataIndex: 'ZB3',
    dispaly: true,
    //filter: true,
    export: true,
  },
  {
    title: '员工4',
    width: 100,
    sorter: true,
    key: 'EMNO4',
    dataIndex: 'EMNO4',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比4(%)',
    width: 100,
    sorter: true,
    key: 'ZB4',
    dataIndex: 'ZB4',
    dispaly: true,
    //filter: true,
    export: true,
  },
  {
    title: '员工5',
    width: 100,
    sorter: true,
    key: 'EMNO5',
    dataIndex: 'EMNO5',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比5(%)',
    width: 100,
    sorter: true,
    key: 'ZB5',
    dataIndex: 'ZB5',
    dispaly: true,
    //filter: true,
    export: true,
  },
];
const controls: API.Control[] = [
  {
    name: 'NY',
    rules: [
      { required: true, message: '按YYYYMM格式输入,例如:202201' },
      { min: 6, max: 6, message: '长度不能小于6，大于6' },
    ],
    type: 'text',
    label: '日期',
    grid: 12 / 24,
  },
  {
    name: 'SJRZR',
    //rules: [{ required: true, message: '不能为空' }],
    type: 'text',
    label: '实际融资人',
    grid: 12 / 24,
  },
  {
    name: 'YWLX',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    label: '业务类型',
    grid: 12 / 24,
  },
  {
    name: 'QXR',
    rules: [{ required: true, message: '起息日不能为空' }],
    type: 'date',
    dataType: 'date',
    label: '起息日',
    grid: 12 / 24,
  },
  {
    name: 'DQR',
    rules: [{ required: true, message: '到期日不能为空' }],
    type: 'date',
    dataType: 'date',
    label: '到期日',
    grid: 12 / 24,
  },
  {
    name: 'BZ',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    label: '币种',
    grid: 12 / 24,
  },
  {
    name: 'ACBL',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '余额(万)',
    grid: 12 / 24,
  },
  {
    name: 'LR',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '利润(万)',
    grid: 12 / 24,
  },
  {
    name: 'EMNO1',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    dataType: 'string',
    label: '员工1',
    grid: 12 / 24,
  },
  {
    name: 'ZB1',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '占比1(%)',
    grid: 12 / 24,
  },
  {
    name: 'EMNO2',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    dataType: 'string',
    label: '员工2',
    grid: 12 / 24,
  },
  {
    name: 'ZB2',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '占比2(%)',
    grid: 12 / 24,
  },
  {
    name: 'EMNO3',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    dataType: 'string',
    label: '员工3',
    grid: 12 / 24,
  },
  {
    name: 'ZB3',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '占比3(%)',
    grid: 12 / 24,
  },
  {
    name: 'EMNO4',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    dataType: 'string',
    label: '员工4',
    grid: 12 / 24,
  },
  {
    name: 'ZB4',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '占比4(%)',
    grid: 12 / 24,
  },
  {
    name: 'EMNO5',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    dataType: 'string',
    label: '员工5',
    grid: 12 / 24,
  },
  {
    name: 'ZB5',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '占比5(%)',
    grid: 12 / 24,
  },
];

const CompJwzDrForm: React.FC = () => {
  return (
    <CommonPage
      daoName={daoName}
      columns={columns}
      controls={controls}
      title="境外债投资导入"
      importName={importName}
      importControls={controls}
      importMode="DeleteAfterInsert"
      importParamNames={['NY']}
      importTemplateName="境外债投资导入"
      initSorter={{ FieldName: 'NY', Direction: 'DESC' }}
    />
  );
};
export default CompJwzDrForm;
